<extend  name="Public:base" />
<block name="content_header">
    <div class="content-header">
        <h2 class="content-title">管理员登录记录列表</h2>
        <span class="layui-breadcrumb">
            <a href="{:U('Index/index')}">首页</a>
            <a>记录管理</a>
            <a><cite>管理员登录记录列表</cite></a>
        </span>
    </div>
</block>
<block name="toolbar">
    <div class="layui-inline">
        用户名：<input class="layui-input search-input" type="text" name="username" id="username" placeholder="请输入关键字" />
    </div>
    <div class="layui-inline">
        日期：<input id="searchDate" class="layui-input search-input date-icon" type="text" name="date" placeholder="请选择日期范围" style="width: 175px;" />
    </div>
    <div class="layui-btn-group toolbar">
        <button class="layui-btn" data-type="search">搜索</button>
    </div>

</block>
<block name="content_body">
    <table class="layui-table" lay-data="{height: 'full-240',cellMinWidth: 80, url:'{:U('Adminlogin/index')}', method:'post', page:{layout: [ 'prev', 'page', 'next', 'skip', 'count']}, id:'dataTable'}" lay-filter="table">
        <thead>
        <tr>
            <th lay-data="{field:'id', width:60, sort: true}">ID</th>
            <th lay-data="{field:'username',width:200}">管理员用户名</th>
            <th lay-data="{field:'login_time',width:200,sort:true}">登录时间</th>
            <th lay-data="{field:'login_ip',width:200}">登录IP地址</th>
        </tr>
        </thead>
    </table>
    <script type="text/html" id="type">

    </script>
</block>
<block name="foot_script">
    <script>
        //JavaScript代码区域
        layui.use(['layer','laydate','table','form'], function(){
            var $ = layui.$, layer = layui.layer,laydate = layui.laydate,table = layui.table,form = layui.form;
            //日期范围
            laydate.render({
                elem: '#searchDate'
                ,range: true
                ,theme: '#393D49'
            });
            // toolbar启用/禁用/删除
            $('.toolbar .layui-btn').on('click', function(){
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });
            var active = {
                search: function(){
                    var username = $('#username');
                    var date = $('#searchDate');
                    //执行重载
                    table.reload('dataTable', {
                        page: {
                            curr: 1 //重新从第 1 页开始
                        }
                        ,where: {
                            username: username.val(),
                            date: date.val()
                        }
                    });
                }
            };

        });


    </script>
</block>